/*
 * @Author: 胡俊/treence
 * @Date: 2022-05-27 15:48:51
 * @LastEditors: 徐伟杰
 * @LastEditTime: 2022-12-19 10:09:29
 * @Description:
 * @Email: treence@gmail.com
 * @Company: 3xData
 * @youWant: add you want
 */

import {} from "@/api/unitTask.js";

const manage = {
  state: {
    online_list: uni.getStorageSync("online_list"), // 离线上传缓存
    startTime: null, // 开始时间
    endTime: null, // 结束时间
    lastTime: null, // 最后一次执业时间

    practice: null, // 用于判断该任务是月度、季度、年度
    taskName: null, // 用于判断任务名称是哪个
    manageList: [], // 执业树
    typeList: [], // 执业子项
    typeListIndex: null, // 执业子项下表，用于暂存时，更新执业树内的数据信息
    contentObj: {}, // 执业内容
    maintainDetailId: null, // 执业id
    changeSate: false, // 通过该字段判断执业子项返回时是否提示

    //! 确认任务时人脸识别
    userInfo: {
      userName: null, // 姓名
      userIdCard: null, // 身份证id
    },
    //! 执业任务时人脸识别
    fuserInfo: {
      fuserName: null, // 姓名
      fuserIdCard: null, // 身份证id
    },

    // 该字段用于判断执业页面中从哪个选项进入执业任务
    practiceState: "look", // 当为write时代表可以进行修改，为look时，代表只能查看
  },
  mutations: {
    // * 将执业信息的开始时间、结束时间、最后一次执业时间缓存起来
    SAVEALLTIMEDATE(state, data) {
      state.startTime = data.startDate;
      state.endTime = data.endDate;
      state.lastTime = data.lastTime;
    },
    saveStartTime(state, data) {
      state.startTime = data;
    },
    saveEndTime(state, data) {
      state.endTime = data;
    },
    saveLastTime(state, data) {
      state.lastTime = data;
    },
    // 将离线上传的数据上传至本地缓存中
    save_online_list(state, data) {
      uni.setStorageSync("online_list", data);
      state.online_list = data;
    },
    save_task_name(state, data) {
      state.taskName = data;
    },
    savePractice(state, data) {
      state.practice = data;
    },
    saveManageList(state, data) {
      state.manageList = data;
    },
    saveTypeList(state, data) {
      state.typeList = data;
    },
    saveTypeListIndex(state, data) {
      state.typeListIndex = data;
    },
    saveContentObj(state, data) {
      state.contentObj = data;
    },
    saveMaintainDetailId(state, data) {
      state.maintainDetailId = data;
    },
    changeState(state, data) {
      state.changeSate = data;
    },
    savefUserName(state, data) {
      state.fuserInfo.fuserName = data;
    },
    savefUserIdCard(state, data) {
      state.fuserInfo.fuserIdCard = data;
    },

    // 修改操作状态
    changePracticeState(state, data) {
      state.practiceState = data;
    },
  },
  actions: {},
};

export default manage;
